<template>
  <div>
<!--    <MusicList title="今日推荐" v-if="todayRecommend.length>0" :data="todayRecommend"/>-->
<!--    <MusicList title="热门推荐" v-if="hotMusic.length>0" :data="hotMusic"/>-->
<!--    <MusicList title="摇滚歌曲" v-if="rockMusic.length>0" :data="rockMusic"/>-->
<!--    <MusicList title="经典歌曲" v-if="oldMusic.length>0" :data="oldMusic"/>-->
    <MusicList v-for="(item, index) in allMusic" :title="item.name" :v-if="item.data.length>0" :data="item.data" :key="item.key"/>
  </div>
</template>

<script>
    import MusicList from "../../components/Home/MusicList";
    export default {
      name: "HomeListData",
      components: {MusicList},
      data() {
        return {
          // activeName: first
        }
      },
      methods: {
        // //加载今日推荐
        // loadRecommendToday() {
        //   this.$api.home.getSongPageList({
        //     current: 1,
        //     size: 6
        //   })
        //   .then(res => {
        //     this.todayRecommend = res.data.data.records;
        //   });
        // },
        // //加载热门歌曲
        // loadHotMusic() {
        //   this.$api.home.getSongPageList({
        //     current: 2,
        //     size: 6
        //   })
        //   .then(res => {
        //     this.hotMusic = res.data.data.records;
        //   });
        // },
        // loadRockMusic() {
        //   this.$api.home.getSongPageList({
        //     current: 7,
        //     size: 3
        //   })
        //     .then(res => {
        //       this.rockMusic = res.data.data.records;
        //     });
        // },
        // loadOldMusic() {
        //   this.$api.home.getSongPageList({
        //     current: 3,
        //     size: 6
        //   })
        //     .then(res => {
        //       this.oldMusic = res.data.data.records;
        //     });
        // }
      },
      mounted() {
        //加载数据
        // this.loadRecommendToday()
        // this.loadHotMusic()
        // this.loadRockMusic()
        // this.loadOldMusic()
      },
      props: {
        allMusic: {
          type: Array,
          default: function () {
            let allMusic = [];
            allMusic.push({
              key: 'recommendMusic',
              name: '今日推荐',
              data: []
            });
            allMusic.push({
              key: 'hotMusic',
              name: '热门推荐',
              data: []
            });
            allMusic.push({
              key: 'rockMusic',
              name: '摇滚歌曲',
              data: []
            });
            allMusic.push({
              key: 'oldMusic',
              name: '经典歌曲',
              data: []
            });
            return allMusic
          }
        }
      }
    }
</script>

<style scoped>

</style>
